#include "d3dUtility.h"


D3DLIGHT9	d3d::InitDirectionalLight(D3DXVECTOR3* direction,D3DXCOLOR*	color)
{
	D3DLIGHT9	light;
	::ZeroMemory(&light,sizeof(light));

	light.Type			=	D3DLIGHT_DIRECTIONAL;
	light.Ambient		=	*color * 0.4f;
	light.Diffuse		=	*color;
	light.Specular		=	*color * 0.6f;
	light.Direction		=	*direction;
	
	return light;
}

D3DLIGHT9	d3d::InitPointLight(D3DXVECTOR3* position,D3DXCOLOR* color)
{
	D3DLIGHT9	light;
	::ZeroMemory(&light,sizeof(light));

	light.Type				=	D3DLIGHT_POINT;
	light.Ambient			=	*color * 0.4f;
	light.Diffuse			=	*color;
	light.Specular			=	*color * 0.6f;
	light.Position			=	*position;
	light.Range				=	1000.0f;
	light.Falloff			=	1.0f;
	light.Attenuation0		=	1.0f;
	light.Attenuation1		=	0.0f;
	light.Attenuation2		=	0.0f;

	return light;
}

D3DLIGHT9	d3d::InitSpotLight(D3DXVECTOR3* position,D3DXVECTOR3* direction,D3DXCOLOR* color)
{
	D3DLIGHT9	light;
	::ZeroMemory(&light,sizeof(light));
	

	light.Type				=	D3DLIGHT_SPOT;
	light.Ambient			=	*color * 0.4f;
	light.Diffuse			=	*color;
	light.Specular			=	*color * 0.6f;
	light.Position			=	*position;
	light.Direction			=	*direction;
	light.Range				=	1000.0f;
	light.Falloff			=	1.0f;
	light.Attenuation0		=	1.0f;
	light.Attenuation1		=	0.0f;
	light.Attenuation2		=	0.0f;
	light.Theta				=	0.5f;
	light.Phi				=	0.7f;

	return light;
}